package com.household.domain.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * Created By wanzhen
 * 2023. 2023/4/4. 19:27
 */
@AllArgsConstructor
@Getter
public enum OrderStatusEnum {

    /**
     * 等待接单
     */
    WAIT_DIST("等待接单",1),
    /**
     * 完成中
     */
    TRANSPORT("订单完成中",2),
    /**
     * 订单完成
     */
    COMPLETE("订单完成", 3),
    /**
     * '订单异常
     */

    ERROR("订单异常", 4);

    private String name;

    @EnumValue
    private int status;

    public static OrderStatusEnum getByStatus(Integer status) {
        return Arrays.stream(values()).filter(e -> e.getStatus() == status).findFirst().orElse(null);
    }
    public void setName(String name) {
        this.name = name;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
